package com.ht.medicaltreatment.activity

import android.content.Intent
import android.view.View
import com.githang.statusbar.StatusBarCompat
import com.gym.baselib.base.BaseActivity
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.utils.ScanUtils
import com.ht.medicaltreatment.utils.SoundUtils
import kotlinx.android.synthetic.main.activity_group_layout.imgStart
import kotlinx.android.synthetic.main.activity_group_layout.llStopScan
import kotlinx.android.synthetic.main.activity_group_layout.tvQueryOrder

/**
 * 分组核验
 */
class GroupCheckActivity : BaseActivity(){

    override fun getLayoutId() = R.layout.activity_group_layout

    override fun init() {
        StatusBarCompat.setStatusBarColor(this,getColor(R.color.white))
        ScanUtils.init()
        setTitle("核验分装")

        imgStart.setOnClickListener {
            llStopScan.visibility = View.VISIBLE
            imgStart.visibility = View.INVISIBLE
            ScanUtils.open {
                llStopScan.visibility = View.GONE
                imgStart.visibility = View.VISIBLE
                ScanUtils.close()
                SoundUtils.playSound(SoundUtils.SOUND_SUCCESS)
                val intent = Intent(this,GroupOrderListActivity::class.java)
                intent.putExtra("uid",it)
                startActivity(intent)
            }
        }
        llStopScan.setOnClickListener {
            ScanUtils.close()
            llStopScan.visibility = View.GONE
            imgStart.visibility = View.VISIBLE
        }

        //表单查询
        tvQueryOrder.setOnClickListener {
            startActivity(GroupQueryOrderActivity::class.java)
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        ScanUtils.onDestroy()
    }

}
